Component({
  /**
   * 组件的属性列表
   */
  properties: {
    propArray: {
      type: Array,
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    selectShow: false,  //初始option不显示
    selectText: "请选择",   //初始内容
    selectData: {},
    animationData: {},  //右边箭头的动画
  },
  /**
   * 组件的方法列表
   */
  methods: {
    selectToggle: function () {
      let nowShow = this.data.selectShow;
      this.setData({
        selectShow: !nowShow
      })
    },
    setText: function (e: any) {
      let nowData = this.properties.propArray;
      let nowIdx = e.target.dataset.index;
      let selectText = nowData[nowIdx].text;
      this.setData({
        selectShow: false,
        selectText,
        selectData: nowData[nowIdx],
      })

      this.triggerEvent('selectChange', {
        selectData: nowData[nowIdx]
      });
    },

    resetSelect: function(){
      this.setData({
        selectShow: false,
        selectText: "请选择"
      });
    }
  },
})